package users

import (
	"context"
	"star/internal/logic/users"

	"star/api/users/v1"
)

func (c *ControllerV1) Login(ctx context.Context, req *v1.LoginReq) (res *v1.LoginRes, err error) {
	tokenString, err := users.Login(ctx, req.Username, req.Password)
	if err != nil {
		return
	}
	return &v1.LoginRes{Token: tokenString}, nil
}
